package yuan.controller;

import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;
import yuan.handler.BaseHandler;

@Controller
public class PhotoController {

    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private BaseHandler baseHandler;

    @GetMapping("/getToken")
    @ResponseBody
    public String getToken(){
        String data=baseHandler.getToken();
        return data;
    }
    @GetMapping("/getBatchDownloadLink")
    @ResponseBody
    public String getBatchDownloadLink(){
        return baseHandler.getBatchDownloadLink().toString();
    }
    @GetMapping("/downLoadFile")
    @ResponseBody
    public String downLoadFile(){
        baseHandler.downLoadPhoto(baseHandler.getBatchDownloadLink());
        return "ok";
    }
    @GetMapping("/upload")
    @ResponseBody
    public String upload(){
     return baseHandler.upload("C://Users//yuan//Desktop//idcard.jpg").toString();
    }
}
